<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class RBS::Prototype::Runtime - rbs: Ruby Standard Library Documentation</title>


<script src="../../js/navigation.js" defer></script>
<script src="../../js/search.js" defer></script>
<script src="../../js/search_index.js" defer></script>
<script src="../../js/searcher.js" defer></script>
<script src="../../js/darkfish.js" defer></script>

<script src="../../js/jquery-3.2.0.min.js"></script>

<script src="../../js/vue.min.js"></script>
<script src="../../js/js.cookie.min.js"></script>

<link href="../../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../../css/rdoc.css" rel="stylesheet">
<link href="../../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../";
  var index_rel_prefix = "../../";
  var darkModeCsseHref = "../../css/rdoc-dm.css"
  var defaultModeCssHref = "../../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../../table_of_contents.html#pages">Pages</a>
    <a href="../../table_of_contents.html#classes">Classes</a>
    <a href="../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link">Object
</div>

        
<div id="includes-section" class="nav-section">
  <h3>Included Modules</h3>

  <ul class="link-list">
    <li><a class="include" href="Helpers.html">RBS::Prototype::Helpers</a>
  </ul>
</div>

        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-block_from_ast_of">#block_from_ast_of</a>
    <li ><a href="#method-i-builder">#builder</a>
    <li ><a href="#method-i-const_name">#const_name</a>
    <li ><a href="#method-i-decls">#decls</a>
    <li ><a href="#method-i-each_included_module">#each_included_module</a>
    <li ><a href="#method-i-ensure_outer_module_declarations">#ensure_outer_module_declarations</a>
    <li ><a href="#method-i-generate_class">#generate_class</a>
    <li ><a href="#method-i-generate_constants">#generate_constants</a>
    <li ><a href="#method-i-generate_methods">#generate_methods</a>
    <li ><a href="#method-i-generate_module">#generate_module</a>
    <li ><a href="#method-i-generate_super_class">#generate_super_class</a>
    <li ><a href="#method-i-merge_rbs">#merge_rbs</a>
    <li ><a href="#method-i-method_type">#method_type</a>
    <li ><a href="#method-i-only_name">#only_name</a>
    <li ><a href="#method-i-parse">#parse</a>
    <li ><a href="#method-i-target-3F">#target?</a>
    <li ><a href="#method-i-target_method-3F">#target_method?</a>
    <li ><a href="#method-i-to_type_name">#to_type_name</a>
    <li ><a href="#method-i-type_args">#type_args</a>
    <li ><a href="#method-i-type_params">#type_params</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-RBS::Prototype::Runtime">
    <h1 id="class-RBS::Prototype::Runtime" class="class">
      class RBS::Prototype::Runtime
    </h1>

    <section class="description">
    
    </section>

      <section id="5Buntitled-5D" class="documentation-section">



        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-env" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">env</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-merge" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">merge</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-outline" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">outline</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-owners_included" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">owners_included</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-patterns" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">patterns</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">(patterns:, env:, merge:, owners_included: [])</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 14</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-value">patterns:</span>, <span class="ruby-value">env:</span>, <span class="ruby-value">merge:</span>, <span class="ruby-value">owners_included:</span> [])
  <span class="ruby-ivar">@patterns</span> = <span class="ruby-identifier">patterns</span>
  <span class="ruby-ivar">@decls</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@modules</span> = []
  <span class="ruby-ivar">@env</span> = <span class="ruby-identifier">env</span>
  <span class="ruby-ivar">@merge</span> = <span class="ruby-identifier">merge</span>
  <span class="ruby-ivar">@owners_included</span> = <span class="ruby-identifier">owners_included</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
    <span class="ruby-constant">Object</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-keyword">end</span>
  <span class="ruby-ivar">@outline</span> = <span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-block_from_ast_of" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">block_from_ast_of</span><span
                                class="method-args">(method)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="block_from_ast_of-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 574</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">block_from_ast_of</span>(<span class="ruby-identifier">method</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">RUBY_VERSION</span> <span class="ruby-operator">&lt;</span> <span class="ruby-string">&#39;3.1&#39;</span>

  <span class="ruby-keyword">begin</span>
    <span class="ruby-identifier">ast</span> = <span class="ruby-constant">RubyVM</span><span class="ruby-operator">::</span><span class="ruby-constant">AbstractSyntaxTree</span>.<span class="ruby-identifier">of</span>(<span class="ruby-identifier">method</span>)
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">ArgumentError</span>
    <span class="ruby-keyword">return</span> <span class="ruby-comment"># When the method is defined in eval</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">block_from_body</span>(<span class="ruby-identifier">ast</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">ast</span>&amp;.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:SCOPE</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-builder" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">builder</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="builder-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 39</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">builder</span>
  <span class="ruby-ivar">@builder</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">DefinitionBuilder</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">env:</span> <span class="ruby-identifier">env</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-const_name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">const_name</span><span
                                class="method-args">(const)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="const_name-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 542</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">const_name</span>(<span class="ruby-identifier">const</span>)
  <span class="ruby-ivar">@module_name_method</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Module</span>.<span class="ruby-identifier">instance_method</span>(<span class="ruby-value">:name</span>)
  <span class="ruby-identifier">name</span> = <span class="ruby-ivar">@module_name_method</span>.<span class="ruby-identifier">bind</span>(<span class="ruby-identifier">const</span>).<span class="ruby-identifier">call</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">name</span>

  <span class="ruby-keyword">begin</span>
    <span class="ruby-constant">Object</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">NameError</span>
    <span class="ruby-comment"># Should generate const name if anonymous or internal module (e.g. NameError::message)</span>
    <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">name</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-decls" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">decls</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="decls-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 47</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">decls</span>
  <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@decls</span>
    <span class="ruby-ivar">@decls</span> = []
    <span class="ruby-ivar">@modules</span> = <span class="ruby-constant">ObjectSpace</span>.<span class="ruby-identifier">each_object</span>(<span class="ruby-constant">Module</span>).<span class="ruby-identifier">to_a</span>
    <span class="ruby-ivar">@modules</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">mod</span><span class="ruby-operator">|</span> <span class="ruby-identifier">target?</span>(<span class="ruby-identifier">mod</span>) }.<span class="ruby-identifier">sort_by</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">mod</span><span class="ruby-operator">|</span> <span class="ruby-identifier">const_name</span>(<span class="ruby-identifier">mod</span>) }.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mod</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">case</span> <span class="ruby-identifier">mod</span>
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Class</span>
        <span class="ruby-identifier">generate_class</span> <span class="ruby-identifier">mod</span>
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Module</span>
        <span class="ruby-identifier">generate_module</span> <span class="ruby-identifier">mod</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-ivar">@decls</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-each_included_module" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">each_included_module</span><span
                                class="method-args">(type_name, mod) { |module_name, module_full_name, mix| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="each_included_module-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 78</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">each_included_module</span>(<span class="ruby-identifier">type_name</span>, <span class="ruby-identifier">mod</span>)
  <span class="ruby-identifier">supers</span> = <span class="ruby-constant">Set</span>[]

  <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">included_modules</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mix</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">supers</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">mix</span>.<span class="ruby-identifier">included_modules</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Class</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">superclass</span>
    <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">included_modules</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mix</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">supers</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">mix</span>
      <span class="ruby-identifier">supers</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">mix</span>.<span class="ruby-identifier">included_modules</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">included_modules</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mix</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">unless</span> <span class="ruby-identifier">supers</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">mix</span>)
      <span class="ruby-keyword">unless</span> <span class="ruby-identifier">const_name</span>(<span class="ruby-identifier">mix</span>)
        <span class="ruby-constant">RBS</span>.<span class="ruby-identifier">logger</span>.<span class="ruby-identifier">warn</span>(<span class="ruby-node">&quot;Skipping anonymous module #{mix} included in #{mod}&quot;</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">module_name</span> = <span class="ruby-identifier">module_full_name</span> = <span class="ruby-identifier">to_type_name</span>(<span class="ruby-identifier">const_name</span>(<span class="ruby-identifier">mix</span>), <span class="ruby-value">full_name:</span> <span class="ruby-keyword">true</span>)
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">module_full_name</span>.<span class="ruby-identifier">namespace</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">type_name</span>.<span class="ruby-identifier">namespace</span>
          <span class="ruby-identifier">module_name</span> = <span class="ruby-constant">TypeName</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">module_full_name</span>.<span class="ruby-identifier">name</span>, <span class="ruby-value">namespace:</span> <span class="ruby-constant">Namespace</span>.<span class="ruby-identifier">empty</span>)
        <span class="ruby-keyword">end</span>

        <span class="ruby-keyword">yield</span> <span class="ruby-identifier">module_name</span>, <span class="ruby-identifier">module_full_name</span>, <span class="ruby-identifier">mix</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ensure_outer_module_declarations" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ensure_outer_module_declarations</span><span
                                class="method-args">(mod)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Generate/find outer module declarations This is broken down into another method to comply with ‘DRY` This generates/finds declarations in nested form &amp; returns the last array of declarations</p>

                              <div class="method-source-code" id="ensure_outer_module_declarations-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 493</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ensure_outer_module_declarations</span>(<span class="ruby-identifier">mod</span>)
  <span class="ruby-operator">*</span><span class="ruby-identifier">outer_module_names</span>, <span class="ruby-identifier">_</span> = <span class="ruby-identifier">const_name</span>(<span class="ruby-identifier">mod</span>).<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/::/</span>) <span class="ruby-comment">#=&gt; parent = [A, B], mod = C</span>
  <span class="ruby-identifier">destination</span> = <span class="ruby-ivar">@decls</span> <span class="ruby-comment"># Copy the entries in ivar @decls, not .dup</span>

  <span class="ruby-identifier">outer_module_names</span>&amp;.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">outer_module_name</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">current_name</span> = <span class="ruby-identifier">outer_module_names</span>[<span class="ruby-value">0</span>, <span class="ruby-identifier">i</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>].<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39;::&#39;</span>)
    <span class="ruby-identifier">outer_module</span> = <span class="ruby-ivar">@modules</span>.<span class="ruby-identifier">detect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">const_name</span>(<span class="ruby-identifier">x</span>) <span class="ruby-operator">==</span> <span class="ruby-identifier">current_name</span> }
    <span class="ruby-identifier">outer_decl</span> = <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">detect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">decl</span><span class="ruby-operator">|</span> <span class="ruby-identifier">decl</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-identifier">outer_module</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Class</span>) <span class="ruby-operator">?</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span> <span class="ruby-operator">:</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Module</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">decl</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">outer_module_name</span>.<span class="ruby-identifier">to_sym</span> }

    <span class="ruby-comment"># Insert AST::Declarations if declarations are not added previously</span>
    <span class="ruby-keyword">unless</span> <span class="ruby-identifier">outer_decl</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">outer_module</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Class</span>)
        <span class="ruby-identifier">outer_decl</span> = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>.<span class="ruby-identifier">new</span>(
          <span class="ruby-value">name:</span> <span class="ruby-identifier">to_type_name</span>(<span class="ruby-identifier">outer_module_name</span>),
          <span class="ruby-value">type_params:</span> <span class="ruby-identifier">type_params</span>(<span class="ruby-identifier">outer_module</span>),
          <span class="ruby-value">super_class:</span> <span class="ruby-identifier">generate_super_class</span>(<span class="ruby-identifier">outer_module</span>),
          <span class="ruby-value">members:</span> [],
          <span class="ruby-value">annotations:</span> [],
          <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
          <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>
        )
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">outer_decl</span> = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Module</span>.<span class="ruby-identifier">new</span>(
          <span class="ruby-value">name:</span> <span class="ruby-identifier">to_type_name</span>(<span class="ruby-identifier">outer_module_name</span>),
          <span class="ruby-value">type_params:</span> <span class="ruby-identifier">type_params</span>(<span class="ruby-identifier">outer_module</span>),
          <span class="ruby-value">self_types:</span> [],
          <span class="ruby-value">members:</span> [],
          <span class="ruby-value">annotations:</span> [],
          <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
          <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>
        )
      <span class="ruby-keyword">end</span>

      <span class="ruby-identifier">destination</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">outer_decl</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">destination</span> = <span class="ruby-identifier">outer_decl</span>.<span class="ruby-identifier">members</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-comment"># Return the array of declarations checked out at the end</span>
  <span class="ruby-identifier">destination</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-generate_class" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">generate_class</span><span
                                class="method-args">(mod)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="generate_class-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 389</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">generate_class</span>(<span class="ruby-identifier">mod</span>)
  <span class="ruby-identifier">type_name</span> = <span class="ruby-identifier">to_type_name</span>(<span class="ruby-identifier">const_name</span>(<span class="ruby-identifier">mod</span>))
  <span class="ruby-identifier">outer_decls</span> = <span class="ruby-identifier">ensure_outer_module_declarations</span>(<span class="ruby-identifier">mod</span>)

  <span class="ruby-comment"># Check if a declaration exists for the actual module</span>
  <span class="ruby-identifier">decl</span> = <span class="ruby-identifier">outer_decls</span>.<span class="ruby-identifier">detect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">decl</span><span class="ruby-operator">|</span> <span class="ruby-identifier">decl</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">decl</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">only_name</span>(<span class="ruby-identifier">mod</span>).<span class="ruby-identifier">to_sym</span> }
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">decl</span>
    <span class="ruby-identifier">decl</span> = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>.<span class="ruby-identifier">new</span>(
      <span class="ruby-value">name:</span> <span class="ruby-identifier">to_type_name</span>(<span class="ruby-identifier">only_name</span>(<span class="ruby-identifier">mod</span>)),
      <span class="ruby-value">type_params:</span> <span class="ruby-identifier">type_params</span>(<span class="ruby-identifier">mod</span>),
      <span class="ruby-value">super_class:</span> <span class="ruby-identifier">generate_super_class</span>(<span class="ruby-identifier">mod</span>),
      <span class="ruby-value">members:</span> [],
      <span class="ruby-value">annotations:</span> [],
      <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>
    )

    <span class="ruby-identifier">outer_decls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">decl</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">each_included_module</span>(<span class="ruby-identifier">type_name</span>, <span class="ruby-identifier">mod</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">module_name</span>, <span class="ruby-identifier">module_full_name</span>, <span class="ruby-identifier">_</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">args</span> = <span class="ruby-identifier">type_args</span>(<span class="ruby-identifier">module_full_name</span>)
    <span class="ruby-identifier">decl</span>.<span class="ruby-identifier">members</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Include</span>.<span class="ruby-identifier">new</span>(
      <span class="ruby-value">name:</span> <span class="ruby-identifier">module_name</span>,
      <span class="ruby-value">args:</span> <span class="ruby-identifier">args</span>,
      <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">annotations:</span> []
    )
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">each_included_module</span>(<span class="ruby-identifier">type_name</span>, <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">singleton_class</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">module_name</span>, <span class="ruby-identifier">module_full_name</span> ,<span class="ruby-identifier">_</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">args</span> = <span class="ruby-identifier">type_args</span>(<span class="ruby-identifier">module_full_name</span>)
    <span class="ruby-identifier">decl</span>.<span class="ruby-identifier">members</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Extend</span>.<span class="ruby-identifier">new</span>(
      <span class="ruby-value">name:</span> <span class="ruby-identifier">module_name</span>,
      <span class="ruby-value">args:</span> <span class="ruby-identifier">args</span>,
      <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">annotations:</span> []
    )
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">generate_methods</span>(<span class="ruby-identifier">mod</span>, <span class="ruby-identifier">type_name</span>, <span class="ruby-identifier">decl</span>.<span class="ruby-identifier">members</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">outline</span>

  <span class="ruby-identifier">generate_constants</span> <span class="ruby-identifier">mod</span>, <span class="ruby-identifier">decl</span>.<span class="ruby-identifier">members</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-generate_constants" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">generate_constants</span><span
                                class="method-args">(mod, decls)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="generate_constants-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 338</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">generate_constants</span>(<span class="ruby-identifier">mod</span>, <span class="ruby-identifier">decls</span>)
  <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">constants</span>(<span class="ruby-keyword">false</span>).<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">value</span> = <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">name</span>)
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span>, <span class="ruby-constant">LoadError</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
      <span class="ruby-constant">RBS</span>.<span class="ruby-identifier">logger</span>.<span class="ruby-identifier">warn</span>(<span class="ruby-node">&quot;Skipping constant #{name} of #{mod} since #{e}&quot;</span>)
      <span class="ruby-keyword">next</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Class</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Module</span>)
    <span class="ruby-keyword">unless</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>
      <span class="ruby-constant">RBS</span>.<span class="ruby-identifier">logger</span>.<span class="ruby-identifier">warn</span>(<span class="ruby-node">&quot;Skipping constant #{name} #{value} of #{mod} as an instance of anonymous class&quot;</span>)
      <span class="ruby-keyword">next</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">type</span> = <span class="ruby-keyword">case</span> <span class="ruby-identifier">value</span>
           <span class="ruby-keyword">when</span> <span class="ruby-keyword">true</span>, <span class="ruby-keyword">false</span>
             <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Bool</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
           <span class="ruby-keyword">when</span> <span class="ruby-keyword">nil</span>
             <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Optional</span>.<span class="ruby-identifier">new</span>(
               <span class="ruby-value">type:</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>),
               <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>
             )
           <span class="ruby-keyword">else</span>
             <span class="ruby-identifier">value_type_name</span> = <span class="ruby-identifier">to_type_name</span>(<span class="ruby-identifier">const_name</span>(<span class="ruby-identifier">value</span>.<span class="ruby-identifier">class</span>))
             <span class="ruby-identifier">args</span> = <span class="ruby-identifier">type_args</span>(<span class="ruby-identifier">value_type_name</span>)
             <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassInstance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">value_type_name</span>, <span class="ruby-value">args:</span> <span class="ruby-identifier">args</span>, <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
           <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">decls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Constant</span>.<span class="ruby-identifier">new</span>(
      <span class="ruby-value">name:</span> <span class="ruby-identifier">to_type_name</span>(<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>),
      <span class="ruby-value">type:</span> <span class="ruby-identifier">type</span>,
      <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>
    )
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-generate_methods" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">generate_methods</span><span
                                class="method-args">(mod, module_name, members)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="generate_methods-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 230</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">generate_methods</span>(<span class="ruby-identifier">mod</span>, <span class="ruby-identifier">module_name</span>, <span class="ruby-identifier">members</span>)
  <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">singleton_methods</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">target_method?</span>(<span class="ruby-identifier">mod</span>, <span class="ruby-value">singleton:</span> <span class="ruby-identifier">name</span>) }.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">method</span> = <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">singleton_class</span>.<span class="ruby-identifier">instance_method</span>(<span class="ruby-identifier">name</span>)

    <span class="ruby-keyword">if</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">original_name</span>
      <span class="ruby-identifier">merge_rbs</span>(<span class="ruby-identifier">module_name</span>, <span class="ruby-identifier">members</span>, <span class="ruby-value">singleton:</span> <span class="ruby-identifier">name</span>) <span class="ruby-keyword">do</span>
        <span class="ruby-constant">RBS</span>.<span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span> <span class="ruby-node">&quot;missing #{module_name}.#{name} #{method.source_location}&quot;</span>

        <span class="ruby-identifier">members</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodDefinition</span>.<span class="ruby-identifier">new</span>(
          <span class="ruby-value">name:</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">name</span>,
          <span class="ruby-value">overloads:</span> [
            <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodDefinition</span><span class="ruby-operator">::</span><span class="ruby-constant">Overload</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">annotations:</span> [], <span class="ruby-value">method_type:</span> <span class="ruby-identifier">method_type</span>(<span class="ruby-identifier">method</span>))
          ],
          <span class="ruby-value">kind:</span> <span class="ruby-value">:singleton</span>,
          <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
          <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>,
          <span class="ruby-value">annotations:</span> [],
          <span class="ruby-value">overloading:</span> <span class="ruby-keyword">false</span>,
          <span class="ruby-value">visibility:</span> <span class="ruby-keyword">nil</span>
        )
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">members</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Alias</span>.<span class="ruby-identifier">new</span>(
        <span class="ruby-value">new_name:</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">name</span>,
        <span class="ruby-value">old_name:</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">original_name</span>,
        <span class="ruby-value">kind:</span> <span class="ruby-value">:singleton</span>,
        <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
        <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>,
        <span class="ruby-value">annotations:</span> [],
        )
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">public_instance_methods</span> = <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">public_instance_methods</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">target_method?</span>(<span class="ruby-identifier">mod</span>, <span class="ruby-value">instance:</span> <span class="ruby-identifier">name</span>) }
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">public_instance_methods</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-identifier">members</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Public</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)

    <span class="ruby-identifier">public_instance_methods</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">method</span> = <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">instance_method</span>(<span class="ruby-identifier">name</span>)

      <span class="ruby-keyword">if</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">original_name</span>
        <span class="ruby-identifier">merge_rbs</span>(<span class="ruby-identifier">module_name</span>, <span class="ruby-identifier">members</span>, <span class="ruby-value">instance:</span> <span class="ruby-identifier">name</span>) <span class="ruby-keyword">do</span>
          <span class="ruby-constant">RBS</span>.<span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span> <span class="ruby-node">&quot;missing #{module_name}##{name} #{method.source_location}&quot;</span>

          <span class="ruby-identifier">members</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodDefinition</span>.<span class="ruby-identifier">new</span>(
            <span class="ruby-value">name:</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">name</span>,
            <span class="ruby-value">overloads:</span> [
              <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodDefinition</span><span class="ruby-operator">::</span><span class="ruby-constant">Overload</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">annotations:</span> [], <span class="ruby-value">method_type:</span> <span class="ruby-identifier">method_type</span>(<span class="ruby-identifier">method</span>))
            ],
            <span class="ruby-value">kind:</span> <span class="ruby-value">:instance</span>,
            <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
            <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>,
            <span class="ruby-value">annotations:</span> [],
            <span class="ruby-value">overloading:</span> <span class="ruby-keyword">false</span>,
            <span class="ruby-value">visibility:</span> <span class="ruby-keyword">nil</span>
          )
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">members</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Alias</span>.<span class="ruby-identifier">new</span>(
          <span class="ruby-value">new_name:</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">name</span>,
          <span class="ruby-value">old_name:</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">original_name</span>,
          <span class="ruby-value">kind:</span> <span class="ruby-value">:instance</span>,
          <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
          <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>,
          <span class="ruby-value">annotations:</span> [],
          )
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">private_instance_methods</span> = <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">private_instance_methods</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">target_method?</span>(<span class="ruby-identifier">mod</span>, <span class="ruby-value">instance:</span> <span class="ruby-identifier">name</span>) }
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">private_instance_methods</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-identifier">members</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Private</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)

    <span class="ruby-identifier">private_instance_methods</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">method</span> = <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">instance_method</span>(<span class="ruby-identifier">name</span>)

      <span class="ruby-keyword">if</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">original_name</span>
        <span class="ruby-identifier">merge_rbs</span>(<span class="ruby-identifier">module_name</span>, <span class="ruby-identifier">members</span>, <span class="ruby-value">instance:</span> <span class="ruby-identifier">name</span>) <span class="ruby-keyword">do</span>
          <span class="ruby-constant">RBS</span>.<span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span> <span class="ruby-node">&quot;missing #{module_name}##{name} #{method.source_location}&quot;</span>

          <span class="ruby-identifier">members</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodDefinition</span>.<span class="ruby-identifier">new</span>(
            <span class="ruby-value">name:</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">name</span>,
            <span class="ruby-value">overloads:</span> [
              <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodDefinition</span><span class="ruby-operator">::</span><span class="ruby-constant">Overload</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">annotations:</span> [], <span class="ruby-value">method_type:</span> <span class="ruby-identifier">method_type</span>(<span class="ruby-identifier">method</span>))
            ],
            <span class="ruby-value">kind:</span> <span class="ruby-value">:instance</span>,
            <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
            <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>,
            <span class="ruby-value">annotations:</span> [],
            <span class="ruby-value">overloading:</span> <span class="ruby-keyword">false</span>,
            <span class="ruby-value">visibility:</span> <span class="ruby-keyword">nil</span>
          )
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">members</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Alias</span>.<span class="ruby-identifier">new</span>(
          <span class="ruby-value">new_name:</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">name</span>,
          <span class="ruby-value">old_name:</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">original_name</span>,
          <span class="ruby-value">kind:</span> <span class="ruby-value">:instance</span>,
          <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
          <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>,
          <span class="ruby-value">annotations:</span> [],
          )
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-generate_module" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">generate_module</span><span
                                class="method-args">(mod)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="generate_module-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 436</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">generate_module</span>(<span class="ruby-identifier">mod</span>)
  <span class="ruby-identifier">name</span> = <span class="ruby-identifier">const_name</span>(<span class="ruby-identifier">mod</span>)

  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">name</span>
    <span class="ruby-constant">RBS</span>.<span class="ruby-identifier">logger</span>.<span class="ruby-identifier">warn</span>(<span class="ruby-node">&quot;Skipping anonymous module #{mod}&quot;</span>)
    <span class="ruby-keyword">return</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">type_name</span> = <span class="ruby-identifier">to_type_name</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-identifier">outer_decls</span> = <span class="ruby-identifier">ensure_outer_module_declarations</span>(<span class="ruby-identifier">mod</span>)

  <span class="ruby-comment"># Check if a declaration exists for the actual class</span>
  <span class="ruby-identifier">decl</span> = <span class="ruby-identifier">outer_decls</span>.<span class="ruby-identifier">detect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">decl</span><span class="ruby-operator">|</span> <span class="ruby-identifier">decl</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Module</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">decl</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">only_name</span>(<span class="ruby-identifier">mod</span>).<span class="ruby-identifier">to_sym</span> }
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">decl</span>
    <span class="ruby-identifier">decl</span> = <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Module</span>.<span class="ruby-identifier">new</span>(
      <span class="ruby-value">name:</span> <span class="ruby-identifier">to_type_name</span>(<span class="ruby-identifier">only_name</span>(<span class="ruby-identifier">mod</span>)),
      <span class="ruby-value">type_params:</span> <span class="ruby-identifier">type_params</span>(<span class="ruby-identifier">mod</span>),
      <span class="ruby-value">self_types:</span> [],
      <span class="ruby-value">members:</span> [],
      <span class="ruby-value">annotations:</span> [],
      <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>
    )

    <span class="ruby-identifier">outer_decls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">decl</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">each_included_module</span>(<span class="ruby-identifier">type_name</span>, <span class="ruby-identifier">mod</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">module_name</span>, <span class="ruby-identifier">module_full_name</span>, <span class="ruby-identifier">_</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">args</span> = <span class="ruby-identifier">type_args</span>(<span class="ruby-identifier">module_full_name</span>)
    <span class="ruby-identifier">decl</span>.<span class="ruby-identifier">members</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Include</span>.<span class="ruby-identifier">new</span>(
      <span class="ruby-value">name:</span> <span class="ruby-identifier">module_name</span>,
      <span class="ruby-value">args:</span> <span class="ruby-identifier">args</span>,
      <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">annotations:</span> []
    )
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">each_included_module</span>(<span class="ruby-identifier">type_name</span>, <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">singleton_class</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">module_name</span>, <span class="ruby-identifier">module_full_name</span>, <span class="ruby-identifier">_</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">args</span> = <span class="ruby-identifier">type_args</span>(<span class="ruby-identifier">module_full_name</span>)
    <span class="ruby-identifier">decl</span>.<span class="ruby-identifier">members</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">Extend</span>.<span class="ruby-identifier">new</span>(
      <span class="ruby-value">name:</span> <span class="ruby-identifier">module_name</span>,
      <span class="ruby-value">args:</span> <span class="ruby-identifier">args</span>,
      <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">comment:</span> <span class="ruby-keyword">nil</span>,
      <span class="ruby-value">annotations:</span> []
    )
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">generate_methods</span>(<span class="ruby-identifier">mod</span>, <span class="ruby-identifier">type_name</span>, <span class="ruby-identifier">decl</span>.<span class="ruby-identifier">members</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">outline</span>

  <span class="ruby-identifier">generate_constants</span> <span class="ruby-identifier">mod</span>, <span class="ruby-identifier">decl</span>.<span class="ruby-identifier">members</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-generate_super_class" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">generate_super_class</span><span
                                class="method-args">(mod)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="generate_super_class-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 376</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">generate_super_class</span>(<span class="ruby-identifier">mod</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">superclass</span> <span class="ruby-operator">==</span> <span class="ruby-operator">::</span><span class="ruby-constant">Object</span>
    <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">const_name</span>(<span class="ruby-identifier">mod</span>.<span class="ruby-identifier">superclass</span>).<span class="ruby-identifier">nil?</span>
    <span class="ruby-constant">RBS</span>.<span class="ruby-identifier">logger</span>.<span class="ruby-identifier">warn</span>(<span class="ruby-node">&quot;Skipping anonymous superclass #{mod.superclass} of #{mod}&quot;</span>)
    <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">super_name</span> = <span class="ruby-identifier">to_type_name</span>(<span class="ruby-identifier">const_name</span>(<span class="ruby-identifier">mod</span>.<span class="ruby-identifier">superclass</span>), <span class="ruby-value">full_name:</span> <span class="ruby-keyword">true</span>).<span class="ruby-identifier">absolute!</span>
    <span class="ruby-identifier">super_args</span> = <span class="ruby-identifier">type_args</span>(<span class="ruby-identifier">super_name</span>)
    <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Declarations</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span><span class="ruby-operator">::</span><span class="ruby-constant">Super</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">super_name</span>, <span class="ruby-value">args:</span> <span class="ruby-identifier">super_args</span>, <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-merge_rbs" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">merge_rbs</span><span
                                class="method-args">(module_name, members, instance: nil, singleton: nil) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="merge_rbs-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 175</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">merge_rbs</span>(<span class="ruby-identifier">module_name</span>, <span class="ruby-identifier">members</span>, <span class="ruby-value">instance:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">singleton:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">merge</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">env</span>.<span class="ruby-identifier">class_decls</span>[<span class="ruby-identifier">module_name</span>.<span class="ruby-identifier">absolute!</span>]
      <span class="ruby-keyword">case</span>
      <span class="ruby-keyword">when</span> <span class="ruby-identifier">instance</span>
        <span class="ruby-identifier">method</span> = <span class="ruby-identifier">builder</span>.<span class="ruby-identifier">build_instance</span>(<span class="ruby-identifier">module_name</span>.<span class="ruby-identifier">absolute!</span>).<span class="ruby-identifier">methods</span>[<span class="ruby-identifier">instance</span>]
        <span class="ruby-identifier">method_name</span> = <span class="ruby-identifier">instance</span>
        <span class="ruby-identifier">kind</span> = <span class="ruby-value">:instance</span>
      <span class="ruby-keyword">when</span> <span class="ruby-identifier">singleton</span>
        <span class="ruby-identifier">method</span> = <span class="ruby-identifier">builder</span>.<span class="ruby-identifier">build_singleton</span>(<span class="ruby-identifier">module_name</span>.<span class="ruby-identifier">absolute!</span>).<span class="ruby-identifier">methods</span>[<span class="ruby-identifier">singleton</span>]
        <span class="ruby-identifier">method_name</span> = <span class="ruby-identifier">singleton</span>
        <span class="ruby-identifier">kind</span> = <span class="ruby-value">:singleton</span>
      <span class="ruby-keyword">end</span>

      <span class="ruby-keyword">if</span> <span class="ruby-identifier">method</span>
        <span class="ruby-identifier">members</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodDefinition</span>.<span class="ruby-identifier">new</span>(
          <span class="ruby-value">name:</span> <span class="ruby-identifier">method_name</span>,
          <span class="ruby-value">overloads:</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">method_types</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">type</span><span class="ruby-operator">|</span>
            <span class="ruby-constant">AST</span><span class="ruby-operator">::</span><span class="ruby-constant">Members</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodDefinition</span><span class="ruby-operator">::</span><span class="ruby-constant">Overload</span>.<span class="ruby-identifier">new</span>(
              <span class="ruby-value">annotations:</span> [],
              <span class="ruby-value">method_type:</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">update</span>.<span class="ruby-identifier">tap</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ty</span><span class="ruby-operator">|</span>
                <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ty</span>.<span class="ruby-identifier">to_s</span>
                  <span class="ruby-identifier">location</span>.<span class="ruby-identifier">source</span>
                <span class="ruby-keyword">end</span>
              <span class="ruby-keyword">end</span>
            )
          },
          <span class="ruby-value">kind:</span> <span class="ruby-identifier">kind</span>,
          <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
          <span class="ruby-value">comment:</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">comments</span>[<span class="ruby-value">0</span>],
          <span class="ruby-value">annotations:</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">annotations</span>,
          <span class="ruby-value">overloading:</span> <span class="ruby-keyword">false</span>,
          <span class="ruby-value">visibility:</span> <span class="ruby-keyword">nil</span>
        )
        <span class="ruby-keyword">return</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-keyword">yield</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">yield</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-method_type" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">method_type</span><span
                                class="method-args">(method)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="method_type-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 108</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">method_type</span>(<span class="ruby-identifier">method</span>)
  <span class="ruby-identifier">untyped</span> = <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)

  <span class="ruby-identifier">required_positionals</span> = []
  <span class="ruby-identifier">optional_positionals</span> = []
  <span class="ruby-identifier">rest</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">trailing_positionals</span> = []
  <span class="ruby-identifier">required_keywords</span> = {}
  <span class="ruby-identifier">optional_keywords</span> = {}
  <span class="ruby-identifier">rest_keywords</span> = <span class="ruby-keyword">nil</span>

  <span class="ruby-identifier">requireds</span> = <span class="ruby-identifier">required_positionals</span>

  <span class="ruby-identifier">block</span> = <span class="ruby-keyword">nil</span>

  <span class="ruby-identifier">method</span>.<span class="ruby-identifier">parameters</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">kind</span>, <span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">kind</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:req</span>
      <span class="ruby-identifier">requireds</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>, <span class="ruby-value">type:</span> <span class="ruby-identifier">untyped</span>)
    <span class="ruby-keyword">when</span> <span class="ruby-value">:opt</span>
      <span class="ruby-identifier">requireds</span> = <span class="ruby-identifier">trailing_positionals</span>
      <span class="ruby-identifier">optional_positionals</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>, <span class="ruby-value">type:</span> <span class="ruby-identifier">untyped</span>)
    <span class="ruby-keyword">when</span> <span class="ruby-value">:rest</span>
      <span class="ruby-identifier">requireds</span> = <span class="ruby-identifier">trailing_positionals</span>
      <span class="ruby-identifier">name</span> = <span class="ruby-keyword">nil</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-value">:*</span> <span class="ruby-comment"># For `def f(...) end` syntax</span>
      <span class="ruby-identifier">rest</span> = <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">name</span>, <span class="ruby-value">type:</span> <span class="ruby-identifier">untyped</span>)
    <span class="ruby-keyword">when</span> <span class="ruby-value">:keyreq</span>
      <span class="ruby-identifier">required_keywords</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">type:</span> <span class="ruby-identifier">untyped</span>)
    <span class="ruby-keyword">when</span> <span class="ruby-value">:key</span>
      <span class="ruby-identifier">optional_keywords</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">type:</span> <span class="ruby-identifier">untyped</span>)
    <span class="ruby-keyword">when</span> <span class="ruby-value">:keyrest</span>
      <span class="ruby-identifier">rest_keywords</span> = <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">type:</span> <span class="ruby-identifier">untyped</span>)
    <span class="ruby-keyword">when</span> <span class="ruby-value">:block</span>
      <span class="ruby-identifier">block</span> = <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Block</span>.<span class="ruby-identifier">new</span>(
        <span class="ruby-value">type:</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span>.<span class="ruby-identifier">empty</span>(<span class="ruby-identifier">untyped</span>).<span class="ruby-identifier">update</span>(<span class="ruby-value">rest_positionals:</span> <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span><span class="ruby-operator">::</span><span class="ruby-constant">Param</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">type:</span> <span class="ruby-identifier">untyped</span>)),
        <span class="ruby-value">required:</span> <span class="ruby-keyword">true</span>,
        <span class="ruby-value">self_type:</span> <span class="ruby-keyword">nil</span>
      )
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">block</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">block_from_ast_of</span>(<span class="ruby-identifier">method</span>)

  <span class="ruby-identifier">return_type</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-value">:initialize</span>
                  <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Bases</span><span class="ruby-operator">::</span><span class="ruby-constant">Void</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>)
                <span class="ruby-keyword">else</span>
                  <span class="ruby-identifier">untyped</span>
                <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">method_type</span> = <span class="ruby-constant">Types</span><span class="ruby-operator">::</span><span class="ruby-constant">Function</span>.<span class="ruby-identifier">new</span>(
    <span class="ruby-value">required_positionals:</span> <span class="ruby-identifier">required_positionals</span>,
    <span class="ruby-value">optional_positionals:</span> <span class="ruby-identifier">optional_positionals</span>,
    <span class="ruby-value">rest_positionals:</span> <span class="ruby-identifier">rest</span>,
    <span class="ruby-value">trailing_positionals:</span> <span class="ruby-identifier">trailing_positionals</span>,
    <span class="ruby-value">required_keywords:</span> <span class="ruby-identifier">required_keywords</span>,
    <span class="ruby-value">optional_keywords:</span> <span class="ruby-identifier">optional_keywords</span>,
    <span class="ruby-value">rest_keywords:</span> <span class="ruby-identifier">rest_keywords</span>,
    <span class="ruby-value">return_type:</span> <span class="ruby-identifier">return_type</span>,
  )

  <span class="ruby-constant">MethodType</span>.<span class="ruby-identifier">new</span>(
    <span class="ruby-value">location:</span> <span class="ruby-keyword">nil</span>,
    <span class="ruby-value">type_params:</span> [],
    <span class="ruby-value">type:</span> <span class="ruby-identifier">method_type</span>,
    <span class="ruby-value">block:</span> <span class="ruby-identifier">block</span>
  )
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-only_name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">only_name</span><span
                                class="method-args">(mod)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the exact name &amp; not compactly declared name</p>

                              <div class="method-source-code" id="only_name-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 537</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">only_name</span>(<span class="ruby-identifier">mod</span>)
  <span class="ruby-comment"># No nil check because this method is invoked after checking if the module exists</span>
  <span class="ruby-identifier">const_name</span>(<span class="ruby-identifier">mod</span>).<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/::/</span>).<span class="ruby-identifier">last</span> <span class="ruby-comment"># (A::B::C) =&gt; C</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-parse" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">parse</span><span
                                class="method-args">(file)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="parse-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 43</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">parse</span>(<span class="ruby-identifier">file</span>)
  <span class="ruby-identifier">require</span> <span class="ruby-identifier">file</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-target-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">target?</span><span
                                class="method-args">(const)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="target-3F-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 26</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">target?</span>(<span class="ruby-identifier">const</span>)
  <span class="ruby-identifier">name</span> = <span class="ruby-identifier">const_name</span>(<span class="ruby-identifier">const</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">name</span>

  <span class="ruby-identifier">patterns</span>.<span class="ruby-identifier">any?</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pattern</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">end_with?</span>(<span class="ruby-string">&quot;*&quot;</span>)
      (<span class="ruby-identifier">name</span> <span class="ruby-operator">||</span> <span class="ruby-string">&quot;&quot;</span>).<span class="ruby-identifier">start_with?</span>(<span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">chop</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">pattern</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-target_method-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">target_method?</span><span
                                class="method-args">(mod, instance: nil, singleton: nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="target_method-3F-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 219</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">target_method?</span>(<span class="ruby-identifier">mod</span>, <span class="ruby-value">instance:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">singleton:</span> <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">case</span>
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">instance</span>
    <span class="ruby-identifier">method</span> = <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">instance_method</span>(<span class="ruby-identifier">instance</span>)
    <span class="ruby-identifier">method</span>.<span class="ruby-identifier">owner</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">mod</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">owners_included</span>.<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">owner</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">m</span> }
  <span class="ruby-keyword">when</span> <span class="ruby-identifier">singleton</span>
    <span class="ruby-identifier">method</span> = <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">singleton_class</span>.<span class="ruby-identifier">instance_method</span>(<span class="ruby-identifier">singleton</span>)
    <span class="ruby-identifier">method</span>.<span class="ruby-identifier">owner</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">singleton_class</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">owners_included</span>.<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">owner</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">singleton_class</span> }
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_type_name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">to_type_name</span><span
                                class="method-args">(name, full_name: false)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="to_type_name-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 64</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_type_name</span>(<span class="ruby-identifier">name</span>, <span class="ruby-value">full_name:</span> <span class="ruby-keyword">false</span>)
  <span class="ruby-operator">*</span><span class="ruby-identifier">prefix</span>, <span class="ruby-identifier">last</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/::/</span>)

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">full_name</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">prefix</span>.<span class="ruby-identifier">empty?</span>
      <span class="ruby-constant">TypeName</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">last</span>.<span class="ruby-identifier">to_sym</span>, <span class="ruby-value">namespace:</span> <span class="ruby-constant">Namespace</span>.<span class="ruby-identifier">empty</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-constant">TypeName</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">last</span>.<span class="ruby-identifier">to_sym</span>, <span class="ruby-value">namespace:</span> <span class="ruby-constant">Namespace</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">prefix</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;::&quot;</span>)))
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-constant">TypeName</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">name:</span> <span class="ruby-identifier">last</span>.<span class="ruby-identifier">to_sym</span>, <span class="ruby-value">namespace:</span> <span class="ruby-constant">Namespace</span>.<span class="ruby-identifier">empty</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-type_args" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">type_args</span><span
                                class="method-args">(type_name)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="type_args-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 557</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">type_args</span>(<span class="ruby-identifier">type_name</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">class_decl</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">class_decls</span>[<span class="ruby-identifier">type_name</span>.<span class="ruby-identifier">absolute!</span>]
    <span class="ruby-identifier">class_decl</span>.<span class="ruby-identifier">type_params</span>.<span class="ruby-identifier">size</span>.<span class="ruby-identifier">times</span>.<span class="ruby-identifier">map</span> { <span class="ruby-value">:untyped</span> }
  <span class="ruby-keyword">else</span>
    []
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-type_params" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">type_params</span><span
                                class="method-args">(mod)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="type_params-source">
            <pre><span class="ruby-comment"># File rbs-3.2.1/lib/rbs/prototype/runtime.rb, line 565</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">type_params</span>(<span class="ruby-identifier">mod</span>)
  <span class="ruby-identifier">type_name</span> = <span class="ruby-identifier">to_type_name</span>(<span class="ruby-identifier">const_name</span>(<span class="ruby-identifier">mod</span>), <span class="ruby-value">full_name:</span> <span class="ruby-keyword">true</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">class_decl</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">class_decls</span>[<span class="ruby-identifier">type_name</span>.<span class="ruby-identifier">absolute!</span>]
    <span class="ruby-identifier">class_decl</span>.<span class="ruby-identifier">type_params</span>
  <span class="ruby-keyword">else</span>
    []
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is a service of <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>, purveyors of fine <a href='https://jamesbritt.bandcamp.com/'>dance noise</a></p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

